import request from '@/utils/request'

export function isSubmitterExist(phone) {
  return request({
    url: '/login/isSubmitterExist?phone='+phone,
    method: 'get'
  })
}

export function isCollectorExist(phone) {
  return request({
    url: '/login/isCollectorExist?phone='+phone,
    method: 'get'
  })
}

export function colTaskList(params){
  return request({
    url: '/task/colTasks',
    method: 'get',
    params: params
  })
}

export function createTask(cid, params){
  return request({
    url: '/task/add?cid=' + cid,
    method: 'get',
    params: params
  })
}

export function filterSub(params){
  return request({
    url: '/task/filter',
    method: 'get',
    params: params
  })
}

export function listAllSub(cid){
  return request({
    url: '/col/listAll?cid=' + cid,
    method: 'get'
  }) 
}

export function colLokTask(tid){
  return request({
    url: '/col/lok?tid=' + tid,
    method: 'get' 
  })
}

export function subLokTask(sid, tid){
  return request({
    url: '/sub/lok?sid=' + sid + '&tid=' + tid,
    method: 'get' 
  })
}

export function slist(params){
  return request({
    url: '/task/slist',
    method: 'get',
    params: params
  })
}

export function dlist(params){
  return request({
    url: '/task/dlist',
    method: 'get',
    params: params
  })
}

export function subTaskList(params){
  return request({
    url: '/task/subTasks',
    method: 'get',
    params: params
  })
}

export function subFile(data){
  return request({
    url: '/sub/upload',
    method: 'post',
    data: data
  })
}

export function subTask(params){
  return request({
    url: '/task/upload',
    method: 'get',
    params: params
  })
}

export function subList(params){
  return request({
    url: '/sub/subTagList',
    method: 'get',
    params: params
  })
}

export function tagList(cid){
  return request({
    url: '/tag/list?cid=' + cid ,
    method: 'get'
  })
}

export function crSub(params){
  return request({
    url: '/sub/crsub',
    method: 'get',
    params: params
  })
}


export function crTag(cid, tag){
  return request({
    url: '/tag/crTag?cid=' + cid + '&tag=' + tag,
    method: 'get',
  })
}

export function isTaskFileExist(id, filename){
  return request({
    url: '/file/isTaskFileExist?id=' + id + '&filename=' + filename,
    method: 'post',
  })
}

export function isSubFileExist(tid, id, filename){
  return request({
    url: '/file/isSubFileExist?tid=' + tid + '&id=' + id + '&filename=' + filename,
    method: 'post',
  })
}

export function getName(sid){
  return request({
    url: '/sub/getName?sid=' + sid,
    method: 'get',
  })
}

export function subTagList(cid, tag){
  return request({
    url: '/sub/subTagList?cid=' + cid + '&tag=' + tag,
    method: 'get',
  })
}

export function insertTagWithSub(params){
  return request({
    url: '/tag/crTagWithSubs',
    method: 'get',
    params: params,
  })
}

export function countByStatus(params){
  return request({
    url: '/coltask/cnt',
    method: 'get',
    params: params,
  })
}

export function fetchTaskWithStatus(params){
  return request({
    url: '/task/cnt',
    method: 'get',
    params: params,
  })
}

export function getListByTid(params){
  return request({
    url: '/task/getListByTid' ,
    method: 'get',
    params: params
  })
}

export function delSub(sid){
  return request({
    url: '/sub/del?sid=' + sid,
    method: 'get',
  })
}

export function delCol(cid){
  return request({
    url: '/col/del?cid=' + cid,
    method: 'get',
  })
}

export function delTask(tid){
  return request({
    url: '/task/cancel?tid=' + tid,
    method: 'get',
  })
}

export function countSub(tid){
  return request({
    url: '/task/subCnt?tid=' + tid,
    method: 'get',
  })
}

export function countDSub(tid){
  return request({
    url: '/task/dsubCnt?tid=' + tid,
    method: 'get',
  })
}